﻿using System;

class LinesAnother
{
    static void Main(string[] args)
    {
        //Telerik Academy Exam 1 @ 7 Dec 2011 Morning

        int N = 8; // 8-те реда
        int[,] matrix = new int[N, N];

        for (int i = 0; i < N; i++)
        {
            int number = int.Parse(Console.ReadLine()); //четем от конзолата
            for (int j = 0; j < N; j++)         //запълваме матрицата с 1 и 0
            {
                int bit = (number >> j) & 1;
                matrix[i,j] = bit;
            }
        }

        int longestLine = 0;
        int longestCount = 0;

        //vertical lines
        for (int i = 0; i < N; i++)
        {
            int currentLine = 0;
            for (int j = 0; j < N; j++)
            {
                while (j < N && matrix[i,j] == 1)
                {
                    currentLine++;
                    j++;
                }
                if (currentLine > longestLine)
                {
                    longestLine = currentLine;
                    longestCount = 1;
                }
                else if (longestLine == currentLine)
                {
                    longestCount++;
                }
                currentLine = 0;
            }
        }

        //horizontal lines
        for (int j = 0; j < N; j++)
        {
            int currentLine = 0;
            for (int i = 0; i < N; i++)
            {
                while (i < N && matrix[i, j] == 1)
                {
                    currentLine++;
                    i++;
                }
                if (currentLine > longestLine)
                {
                    longestLine = currentLine;
                    longestCount = 1;
                }
                else if (longestLine == currentLine)
                {
                    longestCount++;
                }
                currentLine = 0;
            }
        }
        if (longestLine == 1)
        {
            longestCount = longestCount / 2;
        }


        Console.WriteLine(longestLine);
        Console.WriteLine(longestCount);
    }
}

